"""
    MoinMoin - AttachList Macro

    A macro to produce information about attached pages

    Usage: [[AttachInfo]]

    @copyright: 2004 Jacob Cohen, Nigel Metheringham
    @license: GNU GPL, see COPYING for details
"""

from MoinMoin.action.AttachFile import info


# method name: execute
# parameter: macro - MoinMoin.wikimacro.Macro instance
# parameter: args - arguments from RAW data
def execute(macro, args):
    pagename = macro.formatter.page.page_name
    # print is a powerful debugging tool
    # be aware, you should use HTML syntax as well.
    print '<I>' + pagename + '<I>'
    if args:
        pagename = args
    result = info(pagename, macro.request);
    # the result is HTML code, so if you want to look at it use <!-- -->
    # Browser will ignore it
    print '<!--' + result + '-->'
    return result